package util

import ast.statement.SqlStatement
import expr.DB
import visitor.outputvisitor.*

fun toSqlString(sqlNode: SqlStatement, db: DB): String {
    val visitor = when (db) {
        DB.MYSQL -> MysqlOutPutVisitor()
        DB.PGSQL -> PgsqlOutPutVisitor()
        DB.SQLSERVER -> SqlserverOutPutVisitor()
        DB.SQLITE -> SqliteOutPutVisitor()
        DB.CLICKHOUSE -> ClickhouseOutPutVisitor()
        DB.HIVE -> HiveOutPutVisitor()
        DB.ORACLE -> OracleOutPutVisitor()
    }

    visitor.visitSqlStatement(sqlNode)
    return visitor.sql()
}